#pragma once

#include "tree.hpp"

template <typename K, typename V, template <typename, typename> class T>
class Map {
 private:
  Tree<K, V>* tree;

  void update_root() {
    tree = tree->root();
  }

 public:
  Map() { tree = new T<K, V>(); }
  ~Map() { delete tree; }

  const V* get(const K* key) const { return tree->get(key); }
  void set(const K* key, const V* value) {
    tree->set(key, value);
    update_root();
  }
  void remove(const K* key) {
    tree->remove(key);
    update_root();
  }
  bool check() const { return tree->check(); }
};